﻿@using Model.WXshopBuiness;
@using Xproject.Util;
@{
    string Domain = CommonHelper.GetAppSettings("Domin");
    Layout = "~/Views/Shared/_JSlayout.cshtml";
    string promotionId = ViewBag.promotionId;
    string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
@model Promotions
<link href="@Domain/Content/datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
<script src = "@Domain/Content/datetimepicker/js/bootstrap-datetimepicker.min.js" ></script >

<div class="gray-bg">
    <div class="  animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>@ViewBag.Title</h5>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal m-t" id="formPromotions" action="~/Promotions/EditPromotion" method="post">
                            <div class="form-group">

                                <input type="hidden" name="PromotionId" value="@promotionId" />
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">活动名：</label>
                                <div class="col-sm-8">
                                    <input id="PromotionName" name="PromotionName" class="form-control" type="text" required min="4" value="@(Model!=null?Model.PromotionName:"")">
                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">活动系统唯一名：</label>
                                <div class="col-sm-8">
                                    <input id="PromotionUnidName" name="PromotionUnidName" class="form-control" type="text" required min="4" value="@(Model!=null?Model.PromotionUnidName:"")">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注：</label>
                                <div class="col-sm-8">
                                    <input id="Remarks" name="Remarks" class="form-control" type="text" required min="4" value="@(Model!=null?Model.Remarks:"")">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">参数1名称：</label>
                                <div class="col-sm-4">
                                    <input class="form-control" name="Param1Name" id="Param1Name" readonly="readonly" placeholder="参数1名称" required value="好友帮忙砍价一次最大的能砍掉的钱" />
                                </div>
                                <label class="col-sm-1 control-label">参数1：</label>
                                <div class="col-sm-5">
                                    <input class="form-control" type="number" step="0.01" name="Param1" id="Param1" placeholder="参数1" required value="@(Model!=null?Model.Param1:"")" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">参数2名称：</label>
                                <div class="col-sm-4">
                                    <input class="form-control" name="Param2Name" id="Param2Name" placeholder="参数2名称" readonly="readonly"  style="width:100%" required value="此商品发起的砍价活动最多允许多少次砍价(允许多少个朋友帮忙)" />
                                </div>
                                <label class="col-sm-1 control-label">参数2：</label>
                                <div class="col-sm-5">
                                    <input class="form-control" name="Param2" type="number" step="0.01" id="Param2" placeholder="参数2" style="width:100%" required value="@(Model!=null?Model.Param2:"")" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">参数3名称：</label>
                                <div class="col-sm-4">
                                    <input class="form-control" name="Param3Name" id="Param3Name" readonly="readonly" required value="总共允许砍掉多少总价的比例（0.01-1.00)" />
                                </div>
                                <label class="col-sm-1 control-label">参数3：</label>
                                <div class="col-sm-5">
                                    <input class="form-control" name="Param3" id="Param3" type="number" step="0.01"  style="width:100%" placeholder="比如 售价1000元 ,此参数设为0.3,那么最多允许被砍掉300元" required value="@(Model!=null?Model.Param3:"")" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">参数4名称：</label>
                                <div class="col-sm-4">
                                    <input class="form-control" name="Param4Name" id="Param4Name" readonly="readonly" placeholder="参数4名称" required value="第一个砍价人的标准基数" />
                                </div>
                                <label class="col-sm-1 control-label">参数4：</label>
                                <div class="col-sm-5">
                                    <input class="form-control" name="Param4" id="Param4" type="number" step="0.01" placeholder="10意味着 此人砍3.4元，系统送第一个砍价的10元 显示砍价13.4元" required  value="@(Model!=null?Model.Param4:"")"  />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">参数5名称：</label>
                                <div class="col-sm-4">
                                    <input class="form-control" name="Param5Name" id="Param5Name" readonly="readonly" placeholder="参数5名称" required value="暂未使用" />
                                </div>
                                <label class="col-sm-1 control-label">参数5：</label>
                                <div class="col-sm-5">
                                    <input class="form-control" name="Param5" id="Param5" placeholder="参数5" required value="null" />
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">开始时间：</label>
                                <div class="col-sm-3">
                                    <input type="text" value="@(Model!=null?Model.StartTime.ToString("yyyy-MM-dd HH:mm:ss"):now)" id="StartTime"  name="StartTime">                                                                       
                                </div>
                                <label class="col-sm-3 control-label">结束时间：</label>
                                <div class="col-sm-3">
                                    <input type="text"  value="@(Model!=null?Model.EndTime.ToString("yyyy-MM-dd HH:mm:ss"):now)" id="EndTime" name="EndTime">                                                                      
                                </div>
                            </div>


                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <div class="checkbox">
                                        <label>
                                            @if (Model != null)
                                            {
                                            <input type="checkbox" @(Model.Disable ==1 ? "checked" : "") class="checkbox" id="Disable" name="Disable">@("停止活动")
                                             } 
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <button class="btn btn-primary" type="submit">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->

<script type="text/javascript">
    $(document).ready(function () {
        var optionsNew = {
            beforeSubmit: function () {
                //layer.open({ type: 2, time: 2 });
                layer.load(1, { shade: [0.1, '#000'], time: 2000 });
            },
            success: function (data) {
                if (data.Success == true) {
                    layer.alert('编辑成功', { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                } else {
                    layer.alert(data.Data, { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                }
            },
            error: function () {
                alert(JSON.stringify(data));
            },
            type: "post",
            clearForm: false,
            timeout: 100000
        };

        $("#formPromotions").submit(function () {
            $("#formPromotions").ajaxSubmit(optionsNew);// type="button"
            return false;
        });
    });


</script>


<script type="text/javascript">
    $(function (){
        $("#StartTime").datetimepicker();
        $("#EndTime").datetimepicker();
    });
</script>












